import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'

/* Router Modules */
// import componentsRouter from './modules/components'
// import chartsRouter from './modules/charts'
// import tableRouter from './modules/table'
// import nestedRouter from './modules/nested'

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
    noCache: true                if set true, the page will no be cached(default is false)
    affix: true                  if set true, the tag will affix in the tags-view
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */
export const constantRoutes = [
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path(.*)',
        component: () => import('@/views/redirect/index')
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },
  {
    path: '/auth-redirect',
    component: () => import('@/views/login/auth-redirect'),
    hidden: true
  },
  {
    path: '/404',
    component: () => import('@/views/error-page/404'),
    hidden: true
  },
  {
    path: '/401',
    component: () => import('@/views/error-page/401'),
    hidden: true
  },
  {
    path: '/',
    component: Layout,
    redirect: '/userManagement/index',
    children: [
      {
        path: 'dashboard',
        component: () => import('@/views/userManagement/index'),
        name: 'Dashboard',
        meta: { title: 'Dashboard', icon: 'dashboard', affix: true }
      }
    ]
  }
  // {
  //   path: '/documentation',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/documentation/index'),
  //       name: 'Documentation',
  //       meta: { title: 'Documentation', icon: 'documentation', affix: true }
  //     }
  //   ]
  // },
  // {
  //   path: '/guide',
  //   component: Layout,
  //   redirect: '/guide/index',
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/guide/index'),
  //       name: 'Guide',
  //       meta: { title: 'Guide', icon: 'guide', noCache: true }
  //     }
  //   ]
  // },
  // {
  //   path: '/profile',
  //   component: Layout,
  //   redirect: '/profile/index',
  //   hidden: true,
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/profile/index'),
  //       name: 'Profile',
  //       meta: { title: 'Profile', icon: 'user', noCache: true }
  //     }
  //   ]
  // }
]

/**
 * asyncRoutes
 * the routes that need to be dynamically loaded based on user roles
 */
export const asyncRoutes = [
  // {
  //   path: '/permission',
  //   component: Layout,
  //   redirect: '/permission/page',
  //   alwaysShow: true, // will always show the root menu
  //   name: '权限',
  //   meta: {
  //     title: '权限',
  //     icon: 'lock',
  //     roles: ['admin', 'editor'] // you can set roles in root nav
  //   },
  //   children: [
  //     {
  //       path: 'page',
  //       component: () => import('@/views/permission/page'),
  //       name: 'PagePermission',
  //       meta: {
  //         title: '页面权限',
  //         roles: ['admin'] // or you can only set roles in sub nav
  //       }
  //     },
  //     {
  //       path: 'directive',
  //       component: () => import('@/views/permission/directive'),
  //       name: 'DirectivePermission',
  //       meta: {
  //         title: '操作权限'
  //         // if do not set roles, means: this page does not require permission
  //       }
  //     },
  //     {
  //       path: 'role',
  //       component: () => import('@/views/permission/role'),
  //       name: 'RolePermission',
  //       meta: {
  //         title: '角色权限',
  //         roles: ['admin']
  //       }
  //     }
  //   ]
  // },

  {
    path: '/kefu',
    component: Layout,
    children: [
      {
        path: 'index',
        component: () => import('@/views/kefu/KefuView'),
        name: 'kefu',
        meta: { title: '客服', icon: 'el-icon-s-custom', noCache: true }
      }
    ]
  },
  // {
  //   path: '/test',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/test/TestAPP.vue'),
  //       name: 'Icons',
  //       meta: { title: '充值规则', icon: 'el-icon-s-cooperation', noCache: true }
  //     }
  //   ]
  // },

  /** when your routing map is too long, you can split it into small modules **/
  // componentsRouter,
  // chartsRouter,
  // nestedRouter,
  // tableRouter,

  // {
  //   path: '/example',
  //   component: Layout,
  //   redirect: '/example/list',
  //   name: 'Example',
  //   meta: {
  //     title: 'Example',
  //     icon: 'el-icon-s-help'
  //   },
  //   children: [
  //     {
  //       path: 'create',
  //       component: () => import('@/views/example/create'),
  //       name: 'CreateArticle',
  //       meta: { title: 'Create Article', icon: 'edit' }
  //     },
  //     {
  //       path: 'edit/:id(\\d+)',
  //       component: () => import('@/views/example/edit'),
  //       name: 'EditArticle',
  //       meta: { title: 'Edit Article', noCache: true, activeMenu: '/example/list' },
  //       hidden: true
  //     },
  //     {
  //       path: 'list',
  //       component: () => import('@/views/example/list'),
  //       name: 'ArticleList',
  //       meta: { title: 'Article List', icon: 'list' }
  //     }
  //   ]
  // },

  // {
  //   path: '/tab',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/tab/index'),
  //       name: 'Tab',
  //       meta: { title: 'Tab', icon: 'tab' }
  //     }
  //   ]
  // },

  // {
  //   path: '/error',
  //   component: Layout,
  //   redirect: 'noRedirect',
  //   name: 'ErrorPages',
  //   meta: {
  //     title: 'Error Pages',
  //     icon: '404'
  //   },
  //   children: [
  //     {
  //       path: '401',
  //       component: () => import('@/views/error-page/401'),
  //       name: 'Page401',
  //       meta: { title: '401', noCache: true }
  //     },
  //     {
  //       path: '404',
  //       component: () => import('@/views/error-page/404'),
  //       name: 'Page404',
  //       meta: { title: '404', noCache: true }
  //     }
  //   ]
  // },

  // {
  //   path: '/error-log',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'log',
  //       component: () => import('@/views/error-log/index'),
  //       name: 'ErrorLog',
  //       meta: { title: 'Error Log', icon: 'bug' }
  //     }
  //   ]
  // },

  // {
  //   path: '/excel',
  //   component: Layout,
  //   redirect: '/excel/export-excel',
  //   name: 'Excel',
  //   meta: {
  //     title: 'Excel',
  //     icon: 'excel'
  //   },
  //   children: [
  //     {
  //       path: 'export-excel',
  //       component: () => import('@/views/excel/export-excel'),
  //       name: 'ExportExcel',
  //       meta: { title: 'Export Excel' }
  //     },
  //     {
  //       path: 'export-selected-excel',
  //       component: () => import('@/views/excel/select-excel'),
  //       name: 'SelectExcel',
  //       meta: { title: 'Export Selected' }
  //     },
  //     {
  //       path: 'export-merge-header',
  //       component: () => import('@/views/excel/merge-header'),
  //       name: 'MergeHeader',
  //       meta: { title: 'Merge Header' }
  //     },
  //     {
  //       path: 'upload-excel',
  //       component: () => import('@/views/excel/upload-excel'),
  //       name: 'UploadExcel',
  //       meta: { title: 'Upload Excel' }
  //     }
  //   ]
  // },

  // {
  //   path: '/zip',
  //   component: Layout,
  //   redirect: '/zip/download',
  //   alwaysShow: true,
  //   name: 'Zip',
  //   meta: { title: 'Zip', icon: 'zip' },
  //   children: [
  //     {
  //       path: 'download',
  //       component: () => import('@/views/zip/index'),
  //       name: 'ExportZip',
  //       meta: { title: 'Export Zip' }
  //     }
  //   ]
  // },
  {
    path: '/userManagement',
    component: Layout,
    redirect: '/userManagement/index',
    alwaysShow: true,
    name: '用户管理',
    meta: { title: '用户管理', icon: 'el-icon-user-solid' },
    children: [
      {
        path: 'index',
        component: () => import('@/views/userManagement/index'),
        name: '用户管理',
        meta: { title: '用户管理' }
      },
      {
        path: 'address',
        component: () => import('@/views/userManagement/address'),
        name: '用户收货地址管理',
        meta: { title: '用户收货地址管理' }
      }
    ]
  },
  {
    path: '/yunying',
    component: Layout,
    redirect: '/yunying/qrcode',
    alwaysShow: true,
    name: '运营管理',
    meta: { title: '运营管理', icon: 'el-icon-user-solid' },
    children: [
      {
        path: 'qrcode',
        component: () => import('@/views/yunyin/qrcode'),
        name: '企业微信二维码管理',
        meta: { title: '企业微信二维码管理' }
      }
    ]
  },
  {
    path: '/fourteen',
    component: Layout,
    redirect: '/fourteen/index',
    alwaysShow: true,
    name: '14场推荐',
    meta: { title: '14场推荐', icon: 'chart' },
    children: [
      {
        path: 'index',
        component: () => import('@/views/fourteen/index'),
        name: '14场推荐',
        meta: { title: '14场推荐' }
      }
    ]
  },
  {
    path: '/hqinformation',
    component: Layout,
    redirect: '/hqinformation/index',
    alwaysShow: true,
    name: '获取赛事推荐',
    meta: { title: '方案发布', icon: 'edit' },
    children: [
      {
        path: 'index',
        component: () => import('@/views/hqinformation/index'),
        name: '有球赛事推荐',
        meta: { title: '有球赛事推荐' }
      }
    ]
  },
  {
    path: '/aiScheme',
    component: Layout,
    redirect: '/aiScheme/index',
    alwaysShow: true,
    name: 'AI方案管理',
    meta: { title: 'AI方案管理', icon: 'el-icon-s-data' },
    children: [
      {
        path: 'matchList',
        component: () => import('@/views/aiScheme/matchList'),
        name: '赛事管理',
        meta: { title: '赛事管理' }
      },
      {
        path: 'batchManagement',
        component: () => import('@/views/aiScheme/batchManagement'),
        name: '批次管理',
        meta: { title: '批次管理' }
      },
      {
        path: 'index',
        component: () => import('@/views/aiScheme/index'),
        name: '方案管理',
        meta: { title: '方案管理' }
      },
      {
        path: 'expertList',
        component: () => import('@/views/aiScheme/expertList'),
        name: 'AI专家管理',
        meta: { title: 'AI专家管理' }
      }

    ]
  },
  {
    path: '/news',
    component: Layout,
    redirect: '/news/index',
    alwaysShow: true,
    name: '新闻资讯管理',
    meta: { title: '新闻资讯管理', icon: 'message' },
    children: [
      {
        path: 'index',
        component: () => import('@/views/news/index'),
        name: '新闻资讯',
        meta: { title: '新闻资讯管理' }
      },
      {
        path: 'Ai',
        component: () => import('@/views/news/AiIndex'),
        name: 'AI新闻资讯',
        meta: { title: 'AI资讯' }
      }
    ]
  },
  {
    path: '/log',
    component: Layout,
    redirect: '/log/index',
    alwaysShow: true,
    name: '日志管理',
    meta: { title: '日志管理', icon: 'bug' },
    children: [
      {
        path: 'index',
        component: () => import('@/views/log/adminLog'),
        name: '后台操作日志',
        meta: { title: '后台操作日志' }
      },
      {
        path: 'userIndex',
        component: () => import('@/views/log/userApiLog'),
        name: '用户日志',
        meta: { title: '用户日志' }
      }
    ]
  },
  {
    path: '/report',
    component: Layout,
    redirect: '/report/index',
    alwaysShow: true,
    name: '举报管理',
    meta: { title: '举报管理', icon: 'el-icon-warning' },
    children: [
      {
        path: 'index',
        component: () => import('@/views/report/Aireport'),
        name: 'AI举报',
        meta: { title: 'AI举报' }
      },
      {
        path: 'toushu',
        component: () => import('@/views/report/toushu'),
        name: '投诉管理',
        meta: { title: '投诉管理' }
      }
    ]
  },
  {
    path: '/service',
    component: Layout,
    redirect: '/service/dataLog',
    alwaysShow: true,
    name: '轮播图管理',
    meta: { title: '轮播图管理', icon: 'el-icon-picture' },
    children: [
      {
        path: 'dataLog',
        component: () => import('@/views/service/dataLog'),
        name: '轮播图',
        meta: { title: '轮播图管理' }
      }
    ]
  },
  {
    path: '/card',
    component: Layout,
    redirect: '/card/index',
    alwaysShow: true,
    name: '会员卡管理',
    meta: { title: '会员卡管理', icon: 'star' },
    children: [
      {
        path: 'index',
        component: () => import('@/views/membershipCard/vipCard'),
        name: '会员卡',
        meta: { title: '会员卡管理' }
      }
    ]
  },
  {
    path: '/discountCoupon',
    component: Layout,
    redirect: '/discountCoupon/index',
    alwaysShow: true,
    name: 'youh',
    meta: { title: '优惠券管理', icon: 'el-icon-s-finance' },
    children: [
      {
        path: 'index',
        component: () => import('@/views/discountCoupon/discountCoupon'),
        name: '优惠券',
        meta: { title: '优惠券管理' }
      },
      {
        path: 'dis',
        component: () => import('@/views/discountCoupon/discountCouponDis'),
        name: '优惠券查看',
        meta: { title: '优惠券查看' }
      }
    ]
  },
  {
    path: '/sign',
    component: Layout,
    redirect: '/sign/index',
    alwaysShow: true,
    name: 'youh',
    meta: { title: '签到管理', icon: 'el-icon-s-flag' },
    children: [
      {
        path: 'index',
        component: () => import('@/views/sign/sign'),
        name: '签到管理',
        meta: { title: '签到管理' }
      },
      {
        path: 'dis',
        component: () => import('@/views/sign/signPage'),
        name: '签到查看',
        meta: { title: '签到查看' }

      }
    ]
  },
  {
    path: '/activity',
    component: Layout,
    redirect: '/activity/draw',
    alwaysShow: true,
    name: 'activity',
    meta: { title: '活动管理', icon: 'peoples' },
    children: [
      {
        path: 'draw',
        component: () => import('@/views/activity/draw'),
        name: '抽奖管理',
        meta: { title: '抽奖管理' }
      },
      {
        path: 'drawUser',
        component: () => import('@/views/activity/drawHistory'),
        name: '中奖用户管理',
        meta: { title: '中奖用户管理' }

      },
      {
        path: 'drawList',
        component: () => import('@/views/activity/drawList'),
        name: '转盘奖励',
        meta: { title: '转盘奖励' }

      },
      {
        path: 'huodongEdit',
        component: () => import('@/views/activity/edit'),
        name: '活动页面编辑',
        meta: { title: '活动页面编辑' }

      },
      {
        path: 'huodongPageList',
        component: () => import('@/views/activity/huodongPageList'),
        name: '活动管理',
        meta: { title: '活动管理' }
      }
    ]
  },
  {
    path: '/aiVIPcard',
    component: Layout,
    redirect: '/aiVIPcard/index',
    alwaysShow: true,
    name: 'AI会员卡管理',
    meta: { title: 'AI会员卡管理', icon: 'el-icon-s-ticket' },
    children: [
      {
        path: 'index',
        component: () => import('@/views/aiVIPcard/index'),
        name: '会员卡',
        meta: { title: 'AI会员卡管理' }
      }
    ]
  },
  {
    path: '/order',
    component: Layout,
    redirect: '/order/index',
    alwaysShow: true,
    name: '订单管理',
    meta: { title: '订单管理', icon: 'shopping' },
    children: [
      {
        path: 'index',
        component: () => import('@/views/order/index'),
        name: '订单',
        meta: { title: '充值订单' }
      },
      {
        path: 'consumeOrder',
        component: () => import('@/views/consumeOrder/consumeOrder'),
        name: '订单',
        meta: { title: '消耗订单' }
      },
      {
        path: 'shortPlay',
        component: () => import('@/views/shortPlay/index'),
        name: '订单',
        meta: { title: '短剧消耗订单' }
      }
    ]
  },

  {
    path: '/shopping',
    component: Layout,
    redirect: '/shopping/index',
    alwaysShow: true,
    name: '商城管理',
    meta: { title: '商城管理', icon: 'el-icon-s-goods' },
    children: [
      {
        path: 'class',
        component: () => import('@/views/shopping/classList.vue'),
        name: '分类管理',
        meta: { title: '分类管理' }
      },
      {
        path: 'index',
        component: () => import('@/views/shopping/productList.vue'),
        name: '商品管理',
        meta: { title: '商品管理' }
      },
      {
        path: 'order',
        component: () => import('@/views/shopping/orderManagement.vue'),
        name: '订单管理',
        meta: { title: '订单管理' }
      },
      {
        path: 'afterSakes',
        component: () => import('@/views/shopping/afterSalesManagement.vue'),
        name: '售后管理',
        meta: { title: '售后管理' }
      },
      {
        path: 'active',
        component: () => import('@/views/shopping/swiperList.vue'),
        name: '活动管理',
        meta: { title: '轮播图管理' }
      },
      {
        path: 'yhq',
        component: () => import('@/views/shopping/discountCouponList.vue'),
        name: '优惠券管理',
        meta: { title: '优惠券管理' }
      },
      {
        path: 'yhqHistory',
        component: () => import('@/views/shopping/discountCouponListHistory.vue'),
        name: '优惠券领取记录',
        meta: { title: '优惠券领取记录' }
      },

      {
        path: 'pingdanList',
        component: () => import('@/views/shopping/pingdanList.vue'),
        name: '拼团管理',
        meta: { title: '拼团管理' }

      },
      {
        path: 'miaoshaGuanli',
        component: () => import('@/views/shopping/miaoshaGuanli.vue'),
        name: '秒杀管理',
        meta: { title: '秒杀管理' }
      },
      {
        path: 'qiwang',
        component: () => import('@/views/shopping/qiwang.vue'),
        name: '期望商品',
        meta: { title: '期望商品' }

      }
    ]
  },
  {
    path: '/directSeeding',
    component: Layout,
    redirect: '/directSeeding/index',
    alwaysShow: true,
    name: '直播管理',
    meta: { title: '直播管理', icon: 'el-icon-video-camera-solid' },
    children: [
      {
        path: 'index',
        component: () => import('@/views/directSeeding/index'),
        name: '赛事直播管理',
        meta: { title: '赛事直播管理' }
      },
      {
        path: 'newIndex',
        component: () => import('@/views/directSeeding/zhuanJiaLive'),
        name: '专家直播管理',
        meta: { title: '专家直播管理' }
      },
      {
        path: 'liveDisData',
        component: () => import('@/views/directSeeding/liveDisData'),
        name: '直播数据管理',
        meta: { title: '直播数据管理' }
      },
      {
        path: 'xiaoqiuAction',
        component: () => import('@/views/directSeeding/xiaoqiuAction'),
        name: '小球动作管理',
        meta: { title: '小球动作管理' }
      }
    ]
  },
  {
    path: '/hqdirectSeeding',
    component: Layout,
    redirect: '/hqdirectSeeding/index',
    alwaysShow: true,
    name: '有球直播管理',
    meta: { title: '有球直播管理', icon: 'el-icon-video-camera' },
    children: [
      {
        path: 'index',
        component: () => import('@/views/hqdirectSeeding/index'),
        name: '有球直播管理',
        meta: { title: '有球直播管理' }
      }
    ]
  },
  {
    path: '/expert',
    component: Layout,
    redirect: '/expert/index',
    alwaysShow: true,
    name: '专家管理',
    meta: { title: '专家管理', icon: 'el-icon-user' },
    children: [
      {
        path: 'index',
        component: () => import('@/views/expert/index'),
        name: '专家',
        meta: { title: '专家管理' }
      },
      {
        path: 'user',
        component: () => import('@/views/expert/expertUser.vue'),
        name: '专家用户管理',
        meta: { title: '专家用户管理' }
      }
    ]
  },
  {
    path: '/aiPrediction',
    component: Layout,
    redirect: '/aiPrediction/index',
    alwaysShow: true,
    name: 'AI推荐',
    meta: { title: 'AI推荐', icon: 'chart' },
    children: [
      {
        path: 'index',
        component: () => import('@/views/aiPrediction/index'),
        name: 'AI推荐',
        meta: { title: 'AI推荐' }
      },
      {
        path: 'overAndSouce',
        component: () => import('@/views/aiPrediction/overAndSouce.vue'),
        name: 'ove大小球&&比分概率',
        meta: { title: 'ove大小球&&比分概率' }
      }
    ]
  },
  {
    path: '/aiXiaoqiu',
    component: Layout,
    redirect: '/aiXiaoqiu/index',
    alwaysShow: true,
    name: 'AI小球',
    meta: { title: 'AI小球', icon: 'money' },
    children: [
      {
        path: 'list',
        component: () => import('@/views/aiXiaoqiu/list'),
        name: 'AI小球卡管理',
        meta: { title: 'AI小球管理' }
      },
      {
        path: 'index',
        component: () => import('@/views/aiXiaoqiu/index'),
        name: 'AI小球记录',
        meta: { title: 'AI小球记录' }
      }

    ]
  },

  {
    path: '/fourteenList',
    component: Layout,
    redirect: '/fourteenList/index',
    alwaysShow: true,
    name: '14场推荐管理',
    meta: { title: '14场推荐管理', icon: 'chart' },
    children: [
      {
        path: 'index',
        component: () => import('@/views/fourteenList/index'),
        name: '14场推荐管理',
        meta: { title: '14场推荐管理' }
      }
    ]
  },
  // {
  //   path: '/information',
  //   component: Layout,
  //   redirect: '/information/index',
  //   alwaysShow: true,
  //   name: '赛事推荐',
  //   meta: { title: '赛事推荐', icon: 'zip' },
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/information/index'),
  //       name: '赛事推荐',
  //       meta: { title: '赛事推荐' }
  //     }
  //   ]
  // },
  {
    path: '/push',
    component: Layout,
    redirect: '/push/ios',
    alwaysShow: true,
    name: '推送设置',
    meta: { title: '消息推送', icon: 'email' },
    children: [
      {
        path: 'index',
        component: () => import('@/views/push/IosPush.vue'),
        name: 'ios推送',
        meta: { title: 'ios推送' }
      },
      {
        path: 'aindex',
        component: () => import('@/views/push/androidPush.vue'),
        name: '安卓推送',
        meta: { title: '安卓推送' }
      },
      {
        path: 'keepalive',
        component: () => import('@/views/push/KeepAlivePush.vue'),
        name: '保活推送',
        meta: { title: '保活推送' }
      }
    ]
  },

  {
    path: '/giftList',
    component: Layout,
    redirect: '/giftList/index',
    alwaysShow: true,
    name: '礼物管理',
    meta: { title: '礼物管理', icon: 'star' },
    children: [
      {
        path: 'index',
        component: () => import('@/views/giftList/index'),
        name: '礼物管理',
        meta: { title: '礼物管理' }
      },
      {
        path: 'giftRecord',
        component: () => import('@/views/giftRecord/index'),
        name: '礼物赠送记录',
        meta: { title: '礼物赠送记录' }
      }
    ]
  },
  {
    path: '/video',
    redirect: '/video/index',
    alwaysShow: true,
    name: '视频管理',
    component: Layout,
    meta: {
      title: '视频管理',
      icon: 'el-icon-video-camera'
    },
    children: [
      {
        path: 'index',
        component: () => import('@/views/video/video'),
        name: '视频管理',
        meta: { title: '视频管理' }
      }
    ]
  },
  {
    path: '/membersView',
    component: Layout,
    redirect: '/membersView/index',
    alwaysShow: true,
    name: '会员查看记录',
    meta: { title: '会员查看记录', icon: 'eye' },
    children: [
      {
        path: 'index',
        component: () => import('@/views/membersView/index'),
        name: '会员查看记录',
        meta: { title: '会员查看记录' }
      },
      {
        path: 'aiIndex',
        component: () => import('@/views/membersView/aiModeldis'),
        name: 'ai模块查看记录',
        meta: { title: 'ai模块查看记录' }
      }
    ]
  }, {
    path: '/sendUserMoney',
    component: Layout,
    redirect: '/sendUserMoney/index',
    alwaysShow: true,
    name: '赠送/扣除记录',
    meta: { title: '赠送/扣除记录', icon: 'money' },
    children: [
      {
        path: 'index',
        component: () => import('@/views/sendUserMoney/index'),
        name: '赠送/扣除记录',
        meta: { title: '赠送/扣除记录' }
      }
    ]
  },
  {
    path: '/mpapp',
    component: Layout,
    redirect: '/mpapp/index',
    alwaysShow: true,
    name: '小程序',
    meta: { title: '小程序', icon: 'component' },
    children: [
      {
        path: 'index',
        component: () => import('@/views/mpapp/index.vue'),
        name: '过审管理',
        meta: { title: '过审管理' }
      }
    ]
  },
  {
    path: '/iosManagement',
    component: Layout,
    redirect: '/iosManagement/sideMenu',
    alwaysShow: true,
    name: 'iOS管理',
    meta: { title: 'iOS管理', icon: 'el-icon-mobile' },
    children: [
      {
        path: 'sideMenu',
        component: () => import('@/views/iosManagement/sideMenu.vue'),
        name: '左侧菜单管理',
        meta: { title: '左侧菜单管理' }
      },
      {
        path: 'ballMenu',
        component: () => import('@/views/iosManagement/ballMenu.vue'),
        name: '小球菜单管理',
        meta: { title: '小球菜单管理' }
      },
      {
        path: 'indexTxt',
        component: () => import('@/views/iosManagement/indexTxt.vue'),
        name: '首页文本管理',
        meta: { title: '首页文本管理' }
      }

    ]
  },

  // {
  //   path: '/pdf',
  //   component: Layout,
  //   redirect: '/pdf/index',
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/pdf/index'),
  //       name: 'PDF',
  //       meta: { title: 'PDF', icon: 'pdf' }
  //     }
  //   ]
  // },
  // {
  //   path: '/pdf/download',
  //   component: () => import('@/views/pdf/download'),
  //   hidden: true
  // },

  // {
  //   path: '/theme',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/theme/index'),
  //       name: 'Theme',
  //       meta: { title: 'Theme', icon: 'theme' }
  //     }
  //   ]
  // },

  // {
  //   path: '/clipboard',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/clipboard/index'),
  //       name: 'ClipboardDemo',
  //       meta: { title: 'Clipboard', icon: 'clipboard' }
  //     }
  //   ]
  // },

  // {
  //   path: 'external-link',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'https://github.com/PanJiaChen/vue-element-admin',
  //       meta: { title: 'External Link', icon: 'link' }
  //     }
  //   ]
  // },

  // 404 page must be placed at the end !!!
  { path: '*', redirect: '/404', hidden: true }
]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
